package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Administrator on 2017/1/18.
 */
@Controller
public class Show {
   @RequestMapping("/hello.action") @ResponseBody
    public String test(){
        return "hello-------中国人";
    }


    @RequestMapping("/my.do")@ResponseBody
    public String my(){
        return "2017/01/18";
    }

    public int getPf(int i){
        return i*i;
    }

    @RequestMapping("/me") @ResponseBody
    public void my1(HttpServletResponse res, HttpServletRequest req){
        res.setCharacterEncoding("utf-8");
        res.setContentType("text/html;charset=utf-8");
        try {
            PrintWriter out = res.getWriter();
            out.print("天气好冷啊！哎");
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
